package com.bl.student.dao.repository;

import com.bl.student.common.enums.RecommendType;
import com.bl.student.dao.model.RecommendEntity;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.List;

/**
 * Created by liangweikang on 18/1/31.
 */
public interface RecommendRepository extends PagingAndSortingRepository<RecommendEntity, String> {

    Page<RecommendEntity> findByTypeOrderByWeightDesc(RecommendType type, Pageable pageable);

    Page<RecommendEntity> findByTypeOrderByCreateTimeDesc(RecommendType type, Pageable pageable);

    List<RecommendEntity> findAllByTypeOrderByWeightDesc(RecommendType type);

    List<RecommendEntity> findAllByTypeOrderByCreateTimeDesc(RecommendType type);
}
